import request from '@/utils/request'

export function getRoutes() {
  return request({
    url: '/vue-element-admin/routes',
    method: 'get'
  })
}

export function getDevices(data) {
  return request({
    url: '/api/ruo/device/page',
    method: 'post',
    data
  })
}

export function getProducts() {
  return request({
    url: '/api/ruo/product/list',
    method: 'get'
  })
}

export function getDeviceGroups() {
  return request({
    url: '/api/ruo/device-group/list',
    method: 'get'
  })
}

export function addDevice(data) {
  return request({
    url: '/api/ruo/device',
    method: 'post',
    data
  })
}

export function updateDevice(data) {
  return request({
    url: '/api/ruo/device',
    method: 'patch',
    data
  })
}

export function deleteDevice(id) {
  return request({
    url: `/api/ruo/device/${id}`,
    method: 'delete'
  })
}

export function deviceDetail(id) {
  return request({
    url: `/api/ruo/device/${id}`,
    method: 'get'
  })
}
